package com._51cto.healthy.controller;

import com._51cto.healthy.pojo.Image;
import com._51cto.healthy.pojo.SetMeal;
import com._51cto.healthy.service.ImageService;
import com._51cto.healthy.service.SetMealService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class IndexController {

    @DubboReference
    private SetMealService setMealService;
    @DubboReference
    private ImageService imageService;

    @GetMapping("/")
    public String index(Model model){
        List<SetMeal> setMealList = setMealService.queryHot(6);
//        客户端首页广告轮播图
        List<Image> imageList = imageService.queryAll();
        model.addAttribute("ImageList",imageList);
        model.addAttribute("setMealList",setMealList);
        return "index";
    }

}
